package com.mqtt.ctwingmqtt.controller;

import com.mqtt.ctwingmqtt.domain.entity.NbHouseholdValves;
import com.mqtt.ctwingmqtt.service.NbHouseholdValvesService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/nb")
public class NBHouseholdValvesController {

    @Autowired
    private NbHouseholdValvesService nbHouseholdValvesService;

    /**
     * 查询设备地址对应的所有实时数据
     * @param deviceAddress
     * @return
     */
    @GetMapping("/valvesfind")
    public List<NbHouseholdValves> getNBHouseholdValvesByDeviceAddress(@RequestParam String deviceAddress) {
        return nbHouseholdValvesService.findByDeviceAddress(deviceAddress);
    }
}